﻿using System;
using System.ComponentModel;
using System.Windows;

using SBPweb.RIA.Client.Controls.Content;

using SBPweb.PROvibe.Client.Library.Base;
using SBPweb.PROvibe.Client.Library.Controls;

namespace SBPweb.PROvibe.Client.Modules.Browser.Controls
{

    public partial class BrowserWindow : WindowBase
    {

        #region Constructor logic

        public BrowserWindow()
            : base("WindowsRootPanel")
        {
            InitializeComponent();
            //InitializeHandlers();
        }

        #endregion

        #region Methods

        protected override void InitializeHandlers()
        {
            base.InitializeHandlers();
            if (!Application.IsDesignTime && !Application.IsRunningOutOfBrowser)
            {
                this.SizeChanged += new SizeChangedEventHandler(BrowserWindow_SizeChanged);
                this.Opening += new EventHandler<CancelEventArgs>(BrowserWindow_Opening);
                this.Opened += new EventHandler(BrowserWindow_Opened);
                this.Closing += new EventHandler<CancelEventArgs>(BrowserWindow_Closing);
                this.Closed += new EventHandler(BrowserWindow_Closed);
            }
        }

        protected override void FinalizeHandlers()
        {
            if (!Application.IsDesignTime && !Application.IsRunningOutOfBrowser)
            {
                this.SizeChanged -= new SizeChangedEventHandler(BrowserWindow_SizeChanged);
                this.Opening -= new EventHandler<CancelEventArgs>(BrowserWindow_Opening);
                this.Opened -= new EventHandler(BrowserWindow_Opened);
                this.Closing -= new EventHandler<CancelEventArgs>(BrowserWindow_Closing);
                this.Closed -= new EventHandler(BrowserWindow_Closed);
            }
            base.FinalizeHandlers();
        }

        protected override void OnLoaded(object sender, RoutedEventArgs e)
        {
            base.OnLoaded(sender, e);
        }


        private void BrowserWindow_Opening(object sender, CancelEventArgs e)
        {
        }

        private void BrowserWindow_Opened(object sender, EventArgs e)
        {
            //(Content as HtmlFrame).Visibility = Visibility.Visible;
        }

        private void BrowserWindow_Closing(object sender, CancelEventArgs e)
        {
        }

        private void BrowserWindow_Closed(object sender, EventArgs e)
        {
            //(Content as HtmlFrame).Visibility = Visibility.Collapsed;
        }

        private void BrowserWindow_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            //frame.ResizeContainer(e.NewSize);
        }

        #endregion

    }

}